import Vue from 'vue';
import VueI18n from 'vue-i18n';
import locale from 'element-ui/lib/locale';
import { zh, en } from './languages';

Vue.use(VueI18n);

const i18n = new VueI18n({
  locale: window.localStorage.getItem('language') || 'zh', // set locale
  messages: {
    zh,
    en,
  }, // set locale messages
});
locale.i18n((key, value) => i18n.t(key, value));
export default i18n;
